import request from '@/config/axios'



// 广告 VO
export interface AdvertisementsVO {
  id: number // id
  userId: number // 发布用户ID
  categoryId: number // 分类ID
  title: string // 广告标题
  content: string // 广告内容
  contact: string // 联系方式
  viewCount: number // 浏览次数
  status: boolean // 1-正常, 0-下架, 2-违规
}

// 广告 API
export const AdvertisementsApi = {
  // 查询广告分页
  getAdvertisementsPage: async (params: any) => {
    return await request.get({ url: `/shequ/advertisements/page`, params })
  },

  // 查询广告详情
  getAdvertisements: async (id: number) => {
    return await request.get({ url: `/shequ/advertisements/get?id=` + id })
  },

  // 新增广告
  createAdvertisements: async (data: AdvertisementsVO) => {
    return await request.post({ url: `/shequ/advertisements/create`, data })
  },

  // 修改广告
  updateAdvertisements: async (data: AdvertisementsVO) => {
    return await request.put({ url: `/shequ/advertisements/update`, data })
  },

  // 删除广告
  deleteAdvertisements: async (id: number) => {
    return await request.delete({ url: `/shequ/advertisements/delete?id=` + id })
  },

  // 导出广告 Excel
  exportAdvertisements: async (params) => {
    return await request.download({ url: `/shequ/advertisements/export-excel`, params })
  }
}